/*
 * channelInfo.h
 *
 *  Created on: May 14, 2011
 *      Author: Fei Jia
 */

#ifndef CHANNEL_INFO_H_
#define CHANNEL_INFO_H_

#include "condef.h"

class cXMLElement;

struct HostInfo
{
	int id;
	int posX;
	int posY;
	int dataRate; // bits per second
	// TODO - The program crashes when execute this function
//	void parse(cXMLElement *xmlElement)
//	{
//		id = atoi(xmlElement->getFirstChildWithTag("ID")->getNodeValue());
//		posX = atoi(xmlElement->getFirstChildWithTag("PosX")->getNodeValue());
//		posY = atoi(xmlElement->getFirstChildWithTag("PosY")->getNodeValue());
// 		dataRate = atoi(xmlElement->getFirstChildWithTag("DataRate")->getNodeValue());
//	}
};

struct ChannelInfo
{
	int channelLength;
	int channelUpperBoundList[MAX_NUM_CHANNEL];
	int channelLowerBoundList[MAX_NUM_CHANNEL];

	void init()
	{
		channelLength = 0;
	}

	void addChannel(int channelLowerBound, int channelUpperBound)
	{
		channelUpperBoundList[channelLength] = channelUpperBound;
		channelLowerBoundList[channelLength] = channelLowerBound;
		channelLength++;
	}
};

struct ChannelPhysicalInfo
{
	double ber; // bit error rate
	int senderId;
	int receiverId;
	double dataRate; // bits per second
};

struct DataTransmitInfo
{
	simtime_t startTime;
	simtime_t endTime;
	int totalPacketCount;
	int lossPacketCount;
	int totalBitCount;
	int lossBitCount;
	int senderID;
	int receiverID;
	int dataRate;

	void init()
	{
		startTime = 0;
		endTime = 0;
		totalPacketCount = 0;
		lossPacketCount = 0;
		totalBitCount = 0;
		lossBitCount = 0;
		senderID = -1;
		receiverID = -1;
	}
};


#endif /* CHANNEL_INFO_H_ */
